#include <stdio.h>

#define UPPER_BOUND 1000000

typedef unsigned int uint;


uint cycle[UPPER_BOUND], queue[UPPER_BOUND];


void swap (uint *x, uint *y)
{
	uint z = *x;
	*x = *y;
	*y = z;
}


uint cycle_length (uint n)
{
	uint i, c, *cn = cycle + n;

	if (*cn)
		return *cn;

	queue[0] = n;
	i = 1;

	do
	{
		if (n % 2)
		{
			n = 3 * n + 1;
		}
		else
		{
			n = n / 2;
		}
		queue[i] = n;
		++i;
	}
	while (n < UPPER_BOUND && cycle[n] == 0);

	if (n < UPPER_BOUND)
	{
		c = cycle[n];
	}
	else
	{
		c = 1;
		do
		{
			if (n % 2)
			{
				n = 3 * n + 1;
			}
			else
			{
				n = n / 2;
			}
			++c;
		}
		while (n != 1);
	}

	--i;
	while (++c, i--)
	{
		cycle[ queue[i] ] = c;
	}

	return *cn;
}


int main ()
{
	uint i, j, maximum_cycle_length, cl;

	cycle[1] = 1;

	while (scanf("%u %u", &i, &j) == 2)
	{
		printf("%u %u", i, j);
		if (i > j)
			swap (&i, &j);
		maximum_cycle_length = cycle_length (i);
		for (++i; i <= j; ++i)
		{
			cl = cycle_length (i);
			if (maximum_cycle_length < cl)
				maximum_cycle_length = cl;
		}
		printf(" %u\n", maximum_cycle_length);
	}

	return 0;
}